<template>
	<div class="model-setting">
		<div class="shade"></div>
		<div class="popup">
			<div class="title justify-content-between">
				<span class="fs28 colorFFF">任务设置</span>
				<img src="../assets/images/icon-close.png" @click="cancel">
			</div>
			<div class="content">
				<div class="c-title justify-content-between">
	            	<span class="fs24 color161D2E">{{modelName}}-{{equipmentName}}</span>
	            	<div class="flex">
                        <a class="btn" href="./static/file/试验项目配置模板.xlsx" target="_blank" download="试验项目配置模板.xlsx" v-show="tabActive == 1">
                            <img src="../assets/images/icon-down.png">
                            <span>模板下载</span>
                        </a>
                        <a class="btn" href="./static/file/文档检查项目配置模板.xlsx" target="_blank" download="文档检查项目配置模板.xlsx" v-show="tabActive == 2">
                            <img src="../assets/images/icon-down.png">
                            <span>模板下载</span>
                        </a>
	            		<div class="btn" v-loading="upLoading">
	            			<img src="../assets/images/icon-down.png">
	            			<span>导入</span>
                            <input type="file" accept=".xls,.xlsx" @change="uploadFile($event)" />
	            		</div>
	            		<div class="btn" v-loading="exportLoading" @click="exportFile">
	            			<img src="../assets/images/icon-upload-blue.png">
	            			<span>导出</span>
	            		</div>
	            	</div>
	            </div>
	            <div class="tabs flex">
	            	<div class="tab" :class="tabActive == 1 ? 'active' : ''" @click="switchTab(1)">试验项目设置</div>
	            	<div class="tab" :class="tabActive == 2 ? 'active' : ''" @click="switchTab(2)">文档检查项设置</div>
                    <div class="add-list-box">
                        <img src="../assets/images/icon-add-blue.png" class="add-list" v-if="tabActive == 1" @click="testAdd">
                        <img src="../assets/images/icon-add-blue.png" class="add-list" v-else @click="docAdd">
                    </div>
	            </div>
	            <div class="test-set" v-loading="testLoading" v-show="tabActive == 1">
	            	<div class="radios justify-content-between">
	            		<el-radio-group v-model="radio" @change="switchRadio">
						    <el-radio :label="1">装配环节</el-radio>
						    <el-radio :label="2">整机测试</el-radio>
						    <el-radio :label="3">验收试验</el-radio>
						    <el-radio :label="4">例行试验</el-radio>
  						</el-radio-group>
	            	</div>
	            	<div class="theader justify-content-between mt0" v-if="radio == 1 || radio == 2">
		            	<div class="w330">序号</div>
		            	<div class="w961">测试项目</div>
		            	<div class="w1930">测试方法</div>
		            	<div class="w1170">合格判据</div>
		            	<div class="w2332">测试要求</div>
                        <div class="w660">数据记录</div>
                        <div class="w330">详情</div>
		            	<div class="w330">修改</div>
		            	<div class="w330">删除</div>
		            </div>
                    <div class="theader justify-content-between mt0" v-if="radio == 3 || radio == 4">
                        <div class="w330">序号</div>
                        <div class="w670">试验项目</div>
                        <div class="w780">试验条件</div>
                        <div class="w780">测试项目</div>
                        <div class="w780">测试方法</div>
                        <div class="w670">合格判据</div>
                        <div class="w2332">测试要求</div>
                        <div class="w660">数据记录</div>
                        <div class="w330">详情</div>
                        <div class="w330">修改</div>
                        <div class="w330">删除</div>
                    </div>
                    <div class="tbodys">
                        <div v-if="radio == 1 || radio == 2">
                            <div class="tbody justify-content-between" v-for="(item, index) in testList">
                                <div class="w330">{{index+1}}</div>
                                <div class="w961">
                                    <el-input v-model="item.testProject" v-if="item.editing" placeholder="请输入测试项目"></el-input>
                                    <el-tooltip v-else placement="bottom" effect="light">
                                        <div slot="content" class="fs18">{{item.testProject}}</div>
                                        <div class="text-overflow-2 cursor-pointer">{{item.testProject}}</div>
                                    </el-tooltip>
                                </div>
                                <div class="w1930">
                                    <el-input v-model="item.testMethod" v-if="item.editing" placeholder="请输入测试方法"></el-input>
                                    <el-tooltip v-else placement="bottom" effect="light">
                                        <div slot="content" class="fs18">{{item.testMethod}}</div>
                                        <div class="text-overflow-2 cursor-pointer">{{item.testMethod}}</div>
                                    </el-tooltip>
                                </div>
                                <div class="w1170">
                                    <el-input v-model="item.testJudge" v-if="item.editing" placeholder="请输入合格判据"></el-input>
                                    <el-tooltip v-else placement="bottom" effect="light">
                                        <div slot="content" class="fs18">{{item.testJudge}}</div>
                                        <div class="text-overflow-2 cursor-pointer">{{item.testJudge}}</div>
                                    </el-tooltip>
                                </div>
                                <div class="w2332 justify-content-between flex-wrap">
                                    <div class="btn" :class="item.attach.code == 'Y' ? 'active' : ''" @click="testRequirements(1, index, item.attach.code)">附件</div>
                                    <div class="btn" :class="item.data.code == 'Y' ? 'active' : ''" @click="testRequirements(2, index, item.data.code)">数据记录</div>
                                    <div class="btn mt5" :class="item.record.code == 'Y' ? 'active' : ''" @click="testRequirements(3, index, item.record.code)">记录试验条件</div>
                                    <div class="btn mt5" :class="item.media.code == 'Y' ? 'active' : ''" @click="testRequirements(4, index, item.media.code)">多媒体记录</div>
                                </div>
                                <div class="w660 justify-content-center color5379E6 cursor-pointer" v-if="item.data.code == 'Y'" @click="editDataRecords(item, index)">编辑</div>
                                <div class="w660 justify-content-center" v-else>编辑</div>
                                <div class="w330 justify-content-center color5379E6 cursor-pointer" @click="lookDetail(item, 1)">详情</div>
                                <div class="w330 justify-content-center">
                                    <img :src="iconEditShow" class="edit" @click="testCanEdit(index)" @mouseover="iconEditShow = iconEditActive" @mouseleave="iconEditShow = iconEdit">
                                </div>
                                <div class="w330 justify-content-center">
                                    <img :src="iconDelShow" class="del" @click="testDel(index)" @mouseover="iconDelShow = iconDelActive" @mouseleave="iconDelShow = iconDel">
                                </div>
                            </div>
                        </div>
                        <div v-if="radio == 3 || radio == 4">
                            <div class="tbody justify-content-between" v-for="(item, index) in testList">
                                <div class="w330">{{index+1}}</div>
                                <div class="w670">
                                    <el-input v-model="item.expProject" v-if="item.editing" placeholder="请输入试验项目"></el-input>
                                    <el-tooltip v-else placement="bottom" effect="light">
                                        <div slot="content" class="fs18">{{item.expProject}}</div>
                                        <div class="text-overflow-2 cursor-pointer">{{item.expProject}}</div>
                                    </el-tooltip>
                                </div>
                                <div class="w780">
                                    <el-input v-model="item.expCondition" v-if="item.editing" placeholder="请输入试验条件"></el-input>
                                    <el-tooltip v-else placement="bottom" effect="light">
                                        <div slot="content" class="fs18">{{item.expCondition}}</div>
                                        <div class="text-overflow-2 cursor-pointer">{{item.expCondition}}</div>
                                    </el-tooltip>
                                </div>
                                <div class="w780">
                                    <el-input v-model="item.testProject" v-if="item.editing" placeholder="请输入测试项目"></el-input>
                                    <el-tooltip v-else placement="bottom" effect="light">
                                        <div slot="content" class="fs18">{{item.testProject}}</div>
                                        <div class="text-overflow-2 cursor-pointer">{{item.testProject}}</div>
                                    </el-tooltip>
                                </div>
                                <div class="w780">
                                    <el-input v-model="item.testMethod" v-if="item.editing" placeholder="请输入测试方法"></el-input>
                                    <el-tooltip v-else placement="bottom" effect="light">
                                        <div slot="content" class="fs18">{{item.testMethod}}</div>
                                        <div class="text-overflow-2 cursor-pointer">{{item.testMethod}}</div>
                                    </el-tooltip>
                                </div>
                                <div class="w670">
                                    <el-input v-model="item.testJudge" v-if="item.editing" placeholder="请输入合格判据"></el-input>
                                    <el-tooltip v-else placement="bottom" effect="light">
                                        <div slot="content" class="fs18">{{item.testJudge}}</div>
                                        <div class="text-overflow-2 cursor-pointer word-break">{{item.testJudge}}</div>
                                    </el-tooltip>
                                </div>
                                <div class="w2332 justify-content-between flex-wrap">
                                    <div class="btn" :class="item.attach.code == 'Y' ? 'active' : ''" @click="testRequirements(1, index, item.attach.code)">附件</div>
                                    <div class="btn" :class="item.data.code == 'Y' ? 'active' : ''" @click="testRequirements(2, index, item.data.code)">数据记录</div>
                                    <div class="btn mt5" :class="item.record.code == 'Y' ? 'active' : ''" @click="testRequirements(3, index, item.record.code)">记录试验条件</div>
                                    <div class="btn mt5" :class="item.media.code == 'Y' ? 'active' : ''" @click="testRequirements(4, index, item.media.code)">多媒体记录</div>
                                </div>
                                <div class="w660 justify-content-center color5379E6 cursor-pointer" v-if="item.data.code == 'Y'" @click="editDataRecords(item, index)">编辑</div>
                                <div class="w660 justify-content-center" v-else>编辑</div>
                                <div class="w330 justify-content-center color5379E6 cursor-pointer" @click="lookDetail(item, 2)">详情</div>
                                <div class="w330 justify-content-center">
                                    <img :src="iconEditShow" class="edit" @click="testCanEdit(index)" @mouseover="iconEditShow = iconEditActive" @mouseleave="iconEditShow = iconEdit">
                                </div>
                                <div class="w330 justify-content-center">
                                    <img :src="iconDelShow" class="del" @click="testDel(index)" @mouseover="iconDelShow = iconDelActive" @mouseleave="iconDelShow = iconDel">
                                </div>
                            </div>
                        </div>
                    </div>
	            </div>
	            <div class="doc-set" v-show="tabActive == 2">
	            	<div class="theader justify-content-between">
		            	<div class="w330">序号</div>
		            	<div class="w961">检查项目</div>
		            	<div class="w2590">检查方法</div>
		            	<div class="w1170">合格判据</div>
		            	<div class="w2332">检查要求</div>
                        <div class="w330">详情</div>
		            	<div class="w330">修改</div>
		            	<div class="w330">删除</div>
		            </div>
                    <div class="tbodys">
                        <div class="tbody justify-content-between" v-for="(item, index) in docItemList">
                            <div class="w330">{{index+1}}</div>
                            <div class="w961">
                                <el-input v-model="item.checkProject" v-if="item.editing" placeholder="请输入检查项目"></el-input>
                                <el-tooltip v-else placement="bottom" effect="light">
                                    <div slot="content" class="fs18">{{item.checkProject}}</div>
                                    <div class="text-overflow-2 cursor-pointer">{{item.checkProject}}</div>
                                </el-tooltip>
                            </div>
                            <div class="w2590">
                                <el-input v-model="item.checkMethod" v-if="item.editing" placeholder="请输入检查方法"></el-input>
                                <el-tooltip v-else placement="bottom" effect="light">
                                    <div slot="content" class="fs18">{{item.checkMethod}}</div>
                                    <div class="text-overflow-2 cursor-pointer">{{item.checkMethod}}</div>
                                </el-tooltip>
                            </div>
                            <div class="w1170">
                                <el-input v-model="item.testJudge" v-if="item.editing" placeholder="请输入合格判据"></el-input>
                                <el-tooltip v-else placement="bottom" effect="light">
                                    <div slot="content" class="fs18">{{item.testJudge}}</div>
                                    <div class="text-overflow-2 cursor-pointer">{{item.testJudge}}</div>
                                </el-tooltip>
                            </div>
                            <div class="w2332 justify-content-between">
                                <div class="btn" :class="item.attach.code == 'Y' ? 'active' : ''" @click="docAttach(index, item.attach.code)">附件</div>
                                <div class="btn" :class="item.media.code == 'Y' ? 'active' : ''" @click="docMedia(index, item.media.code)">多媒体记录</div>
                            </div>
                            <div class="w330 justify-content-center color5379E6 cursor-pointer" @click="lookDetail(item, 3)">详情</div>
                            <div class="w330 justify-content-center">
                                <img :src="iconEditShow" class="edit" @click="docCanEdit(index)" @mouseover="iconEditShow = iconEditActive" @mouseleave="iconEditShow = iconEdit">
                            </div>
                            <div class="w330 justify-content-center">
                                <img :src="iconDelShow" class="del" @click="docDel(index)" @mouseover="iconDelShow = iconDelActive" @mouseleave="iconDelShow = iconDel">
                            </div>
                        </div>
                    </div>
	            </div>
			</div>
            <div class="btns justify-content-center">
                <div class="btn sure" v-loading="saveLoading" @click="save">确认</div>
                <div class="btn cancel" @click="cancel">取消</div>
            </div>
		</div>
        <ListDetail v-if="showDetail" :data="detailData" :type="detailType" @cancel="closeDetail"></ListDetail>
        <DataRecords v-if="showDataRecord" :data="dataRecordList" @cancel="closeDataRecord"></DataRecords>
	</div>
</template>

<script>
import ListDetail from '@/components/ListDetail'
import DataRecords from '@/components/DataRecords'
export default {
    name: 'ModelSetting',
    props: {
    	modelId: Number, //型号id
    	modelName: String //型号名称
    },
    components: {ListDetail, DataRecords},
    data () {
        return {
            iconEditShow: require("../assets/images/icon-edit-gray.png"),
            iconEditActive: require("../assets/images/icon-edit-green.png"),
            iconEdit: require("../assets/images/icon-edit-gray.png"),
            iconDelShow: require("../assets/images/icon-del-small-gray.png"),
            iconDel: require("../assets/images/icon-del-small-gray.png"),
            iconDelActive: require("../assets/images/icon-del-small.png"),
        	equipmentName: '', //型号名称
        	tabActive: 1, //激活tab
        	testLoading: false, //试验项目加载中
        	testData: null, //试验项目数据
        	radio: 1, //试验设置选中radio
        	testList: [{
            	testProject: '',
            	testMethod: '',
            	testJudge: '',
            	attach: 'N',
            	data: 'N',
            	record: 'N',
            	media: 'N',
            	editing: false
            }], //试验项目显示列表
            docItemList: [{
            	checkProject: '',
            	checkMethod: '',
            	testJudge: '',
            	attach: 'N',
            	media: 'N',
            	editing: false
            }], //文档设置项列表数据
            saveLoading: false, //保存加载中
            upLoading: false, //导入加载中
            exportLoading: false, //导出加载中
            showDetail: false, //显示详情弹窗
            detailData: null, //详情数据
            detailType: '', //数据类型
            showDataRecord: false, //显示数据记录弹窗
            dataRecordList: [], //数据记录列表
            editType: '', //编辑数据类型
            editIndex: '' //编辑数据下标
        }
    },
    created() {
    	this.getTestList();
    	this.getDocItemList();
    },
    methods: {
    	// 关闭弹窗
    	cancel() {
    		this.$emit('cancel')
    	},
    	/**
    	 * 切换tab
    	 * @param {Number} index - 点击tab下标
    	 */
    	switchTab(index) {
    		this.tabActive = index;
    	},
    	/**
    	 * 切换radio
    	 * @param {Number} e - 选中的 Radio label 值
    	 */
    	switchRadio(e) {
    		if (e == 1) {
    			this.testList = this.testData.zphjList;
    		} else if (e == 2) {
    			this.testList = this.testData.zjcsList;
    		} else if (e == 3) {
    			this.testList = this.testData.yssyList;
    		} else if (e == 4) {
    			this.testList = this.testData.lxsyList;
    		}
    	},
    	// 获取试验项目列表数据
    	getTestList() {
    		let _this = this;
    		let params = {
    			deviceId: _this.modelId
    		};
    		_this.testLoading = true;
            _this.axios.testProjectList(params).then((res) => {
                console.log(res)
                if (res.code == 200) {
                    res.data.zphjList.map((item) => {
                    	item.editing = false;
                    	return item;
                    });
                    res.data.zjcsList.map((item) => {
                    	item.editing = false;
                    	return item;
                    });
                    res.data.yssyList.map((item) => {
                    	item.editing = false;
                    	return item;
                    });
                    res.data.lxsyList.map((item) => {
                    	item.editing = false;
                    	return item;
                    });
                    _this.testData = res.data;
                    _this.testList = res.data.zphjList;
                    _this.equipmentName = res.data.deviceName;
                } else {
                    _this.$message.error(res.msg);
                }
                _this.testLoading = false;
            }).catch(function (error) {
            	_this.testLoading = false;
                _this.$message.error(error.msg);
            });
    	},
    	// 获取文档设置项列表数据
    	getDocItemList() {
    		let _this = this;
    		let params = {
    			deviceId: _this.modelId
    		};
            _this.axios.documentItemList(params).then((res) => {
                console.log(res)
                if (res.code == 200) {
                    res.data.map((item) => {
                    	item.editing = false;
                    	return item;
                    });
                    _this.docItemList = res.data;
                } else {
                    _this.$message.error(res.msg);
                }
            }).catch(function (error) {
                _this.$message.error(error.msg);
            });
    	},
    	// 新增试验项目
    	testAdd() {
    		let test = {
            	testProject: '',
            	testMethod: '',
            	testJudge: '',
            	attach: {
                    code: 'N',
                    message: "否"
                },
            	data: {
                    code: 'N',
                    message: "否"
                },
            	record: {
                    code: 'N',
                    message: "否"
                },
            	media: {
                    code: 'N',
                    message: "否"
                },
            	editing: true
            };
    		this.testList.push(test);
    	},
    	// 新增文档设置项
    	docAdd() {
    		let doc = {
    			checkProject: '',
            	checkMethod: '',
            	testJudge: '',
            	attach: {
                    code: 'N',
                    message: "否"
                },
            	media: {
                    code: 'N',
                    message: "否"
                },
            	editing: true
    		};
    		this.docItemList.push(doc);
    	},
    	/**
    	 * 试验项目检查要求
    	 * @param {Number} btn - 点击按钮
    	 * @param {Number} index - 数据下标
    	 * @param {String} status - 当前状态 Y是 N否
    	 */
    	testRequirements(btn, index, status) {
    		let temp = this.testList[index];
    		if (btn == 1) {
    			temp.attach.code = status == "Y" ? "N" : "Y";
    		} else if (btn == 2) {
    			temp.data.code = status == "Y" ? "N" : "Y";
    		} else if (btn == 3) {
    			temp.record.code = status == "Y" ? "N" : "Y";
    		} else if (btn == 4) {
    			temp.media.code = status == "Y" ? "N" : "Y";
    		}
    		this.$set(this.testList, index, temp);
    	},
    	/**
    	 * 文档设置项是否附件
    	 * @param {Number} index - 数据下标
    	 * @param {String} status - 当前状态 Y是 N否
    	 */
    	docAttach(index, status) {
    		let temp = this.docItemList[index];
    		temp.attach.code = status == "Y" ? "N" : "Y";
    		this.$set(this.docItemList, index, temp);
    	},
    	/**
    	 * 文档设置项多媒体记录
    	 * @param {Number} index - 数据下标
    	 * @param {String} status - 当前状态 Y是 N否
    	 */
    	docMedia(index, status) {
    		let temp = this.docItemList[index];
    		temp.media.code = status == "Y" ? "N" : "Y";
    		this.$set(this.docItemList, index, temp);
    	},
        /**
         * 查看详情
         * @param {Object} row - 详情数据
         * @param {Number} type - 数据类型
         */
        lookDetail(row, type) {
            this.detailData = row;
            this.detailType = type;
            this.showDetail = true
        },
        // 关闭详情弹窗
        closeDetail() {
            this.showDetail = false
        },
        /**
         * 查看数据记录
         * @param {Object} row - 数据记录列表数据
         * @param {Number} index - 数据下标
         */
        editDataRecords(row, index) {
            this.dataRecordList = row;
            this.editIndex = index;
            this.showDataRecord = true;
        },
        /**
         * 关闭数据记录弹窗
         * @param {Number} isSave - 是否保存数据
         * @param {Object} data - 数据记录列表数据
         */
        closeDataRecord(isSave, data) {
            if (isSave == 1) {
                let temp = this.testList[this.editIndex];
                temp.itemList = data;
                this.$set(this.testList, this.editIndex, temp);
            }
            this.showDataRecord = false;
        },
    	/**
    	 * 编辑试验项目
    	 * @param {Number} index - 编辑数据下标
    	 */
    	testCanEdit(index) {
    		let temp = this.testList[index];
    		temp.editing = true;
    		this.$set(this.testList, index, temp);
    	},
    	/**
    	 * 编辑文档设置项
    	 * @param {Number} index - 编辑数据下标
    	 */
    	docCanEdit(index) {
    		let temp = this.docItemList[index];
    		temp.editing = true;
    		this.$set(this.docItemList, index, temp);
    	},
    	/**
    	 * 删除试验项目
    	 * @param {Number} index - 删除数据下标
    	 */
    	testDel(index) {
    		this.testList.splice(index, 1);
    	},
    	/**
    	 * 删除文档设置项
    	 * @param {Number} index - 删除数据下标
    	 */
    	docDel(index) {
    		this.docItemList.splice(index, 1);
    	},
    	// 保存
    	save() {
    		let _this = this;
    		if (_this.tabActive == 1) {
                let params = JSON.parse(JSON.stringify(_this.testData));
                params.zphjList.map((item) => {
                    item.attach = item.attach.code;
                    item.data = item.data.code;
                    item.media = item.media.code;
                    item.record = item.record.code;
                    return item;
                });
                params.zjcsList.map((item) => {
                    item.attach = item.attach.code;
                    item.data = item.data.code;
                    item.media = item.media.code;
                    item.record = item.record.code;
                    return item;
                });
                params.yssyList.map((item) => {
                    item.attach = item.attach.code;
                    item.data = item.data.code;
                    item.media = item.media.code;
                    item.record = item.record.code;
                    return item;
                });
                params.lxsyList.map((item) => {
                    item.attach = item.attach.code;
                    item.data = item.data.code;
                    item.media = item.media.code;
                    item.record = item.record.code;
                    return item;
                });
	    		_this.saveLoading = true;
	            _this.axios.testProjectSave(params).then((res) => {
	                console.log(res)
	                if (res.code == 200) {
	                    _this.$message({
                            message: res.msg,
                            type: 'success'
                        });
	                } else {
                        _this.$message.error(res.msg);
                    }
	                _this.saveLoading = false;
	            }).catch(function (error) {
	            	_this.saveLoading = false;
	                _this.$message.error(error.msg);
	            });
    		} else {
                let newDocItemList = JSON.parse(JSON.stringify(_this.docItemList));
                newDocItemList.map((item) => {
                    item.attach = item.attach.code;
                    item.media = item.media.code;
                    return item;
                });
	    		let params = {
	    			deviceId: _this.modelId,
	    			list: newDocItemList
	    		};
	    		_this.saveLoading = true;
	            _this.axios.documentItemSave(params).then((res) => {
	                console.log(res)
	                if (res.code == 200) {
	                    _this.$message({
                            message: res.msg,
                            type: 'success'
                        });
	                } else {
                        _this.$message.error(res.msg);
                    }
	                _this.saveLoading = false;
	            }).catch(function (error) {
	            	_this.saveLoading = false;
	                _this.$message.error(error.msg);
	            });
    		}
    	},
        // 文件导入
        uploadFile(e) {
            let _this = this;
            let file = e.target.files[0];
            let formData = new FormData();
            formData.append("file", file);
            _this.upLoading = true;
            if (_this.tabActive == 1) {
                _this.axios.uploadFile(formData, _this.modelId).then((res) => {
                    console.log(res)
                    if (res.code == 200) {
                        _this.$message({
                            message: res.msg,
                            type: 'success'
                        })
                        _this.getTestList();
                    }
                    _this.upLoading = false;
                }).catch(function (error) {
                    console.log(error)
                    _this.upLoading = false;
                    _this.$message.error(error.msg);
                });
            } else {
                _this.axios.uploadDocFile(formData, _this.modelId).then((res) => {
                    console.log(res)
                    if (res.code == 200) {
                        _this.$message({
                            message: res.msg,
                            type: 'success'
                        })
                        _this.getDocItemList();
                    }
                    _this.upLoading = false;
                }).catch(function (error) {
                    console.log(error)
                    _this.upLoading = false;
                    _this.$message.error(error.msg);
                });
            }
        },
        // 文件导出
        exportFile() {
            let _this = this;
            let params = {
                deviceId: _this.modelId
            }
            _this.exportLoading = true;
            if (_this.tabActive == 1) {
                _this.axios.exportFile(params).then((res) => {
                    if (res) {
                        let blob = new Blob([res]);
                        let fileName = '试验项目配置.xlsx';
                        let linkNode = document.createElement('a');
                        linkNode.download = fileName;
                        linkNode.style.display = 'none';
                        linkNode.href = URL.createObjectURL(blob);
                        document.body.appendChild(linkNode);
                        linkNode.click();
                        URL.revokeObjectURL(linkNode.href);
                        document.body.removeChild(linkNode);
                    }
                    _this.exportLoading = false;
                }).catch(function (error) {
                    _this.exportLoading = false;
                    _this.$message.error(error.msg);
                });
            } else {
                _this.axios.exportDocFile(params).then((res) => {
                    if (res) {
                        let blob = new Blob([res]);
                        let fileName = '文档检查项目配置.xlsx';
                        let linkNode = document.createElement('a');
                        linkNode.download = fileName;
                        linkNode.style.display = 'none';
                        linkNode.href = URL.createObjectURL(blob);
                        document.body.appendChild(linkNode);
                        linkNode.click();
                        URL.revokeObjectURL(linkNode.href);
                        document.body.removeChild(linkNode);
                    }
                    _this.exportLoading = false;
                }).catch(function (error) {
                    _this.exportLoading = false;
                    _this.$message.error(error.msg);
                });
            }
        }
    }
}
</script>

<style scoped lang='less'>
    @import url('../assets/css/public.css');
    .model-setting {width: 100%;height: 100%;position: fixed;top: 0;left: 0;z-index: 999;
    	.shade {width: 100%;height: 100%;background: rgba(0,0,0,.3);}
		.popup {width: 1243rem;height: 746rem;position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);background-color: #FFF;box-shadow: 0 5rem 15rem 0 rgba(0, 21, 54, 0.25);
			.title {width: 100%;height: 58rem;background-color: #285FE3;padding: 0 25rem 0 40rem;
				img {width: 23rem;height: 23rem;cursor: pointer;}
			}
			.content {width: 100%;padding: 0 40rem;
				.c-title {width: 100%;height: 54rem;
					.btn {min-width: 100rem;height: 34rem;display: flex;align-items: center;justify-content: center;border: 1px solid #316EFF;background: linear-gradient(0deg, #D8DCE7 0%, #FFFFFF 100%);border-radius: 3rem;margin-left: 20rem;cursor: pointer;position: relative;padding: 0 15rem;text-decoration: none;
						img {width: 20rem;height: 20rem;margin-right: 7rem;}
						span {font-size: 18rem;color: #285FE3;}
                        input {width: 100%;height: 100%;position: absolute;top: 0;left: 0;z-index: 99;opacity: 0;}
					}
				}
				.tabs {width: 100%;height: 48rem;background: #F4F5F8;border: 1px solid #D0D6E3;border-radius: 3rem;padding-left: 33rem;
					.tab {min-width: 138rem;height: 48rem;line-height: 48rem;text-align: center;margin-right: 45rem;position: relative;font-size: 20rem;color: #505971;cursor: pointer;}
					.tab.active {color: #161D2E;}
					.tab.active:after {display: block;content: "";width: 138rem;height: 4rem;position: absolute;bottom: 0;left: 50%;transform: translate(-50%);background-color: #285FE3;}
				}
				.radios {width: 100%;height: 48rem;padding-left: 33rem;}
				.theader {width: 100%;height: 40rem;background: #F4F5F8;border: 1px solid #D0D6E3;border-radius: 3rem;padding: 0 26rem 0 36rem;font-size: 18rem;color: #505971;margin-top: 20rem;
					div {text-align: center;}
				}
                .tbodys {width: 100%;max-height: 378rem;overflow-y: scroll;}
                .tbodys::-webkit-scrollbar {display: none;}
                .tbodys {scrollbar-width: none;-ms-overflow-style: none;overflow-x: hidden;overflow-y: auto;}
				.tbody {width: 100%;height: 60rem;border: 1px solid #D0D6E3;border-radius: 3rem;padding: 0 26rem 0 36rem;font-size: 18rem;color: #161D2E;margin-top: 3rem;
					.btn {width: 126rem;height: 24rem;line-height: 22rem;text-align: center;border: 1px solid #316EFF;border-radius: 3rem;font-size: 18rem;color: #285FE3;cursor: pointer;}
					.btn.active {background-color: #285FE3;color: #FFF;border: 0;}
					.edit {width: 25rem;height: 30rem;cursor: pointer;}
					.del {width: 27rem;height: 30rem;cursor: pointer;}
				}
                .add-list-box {width: 50%;flex: 1;display: flex;align-items: center;justify-content: flex-end;}
				.add-list {width: 36rem;height: 36rem;cursor: pointer;}
				.w330 {width: 3.3%;text-align: center;}
                .w660 {width: 6.6%;text-align: center;}
                .w670 {width: 6.7%;text-align: center;}
                .w780 {width: 7.8%;text-align: center;}
                .w894 {width: 8.94%;text-align: center;}
				.w961 {width: 9.61%;text-align: center;}
                .w1930 {width: 19.3%;text-align: center;}
                .w2590 {width: 25.9%;text-align: center;}
				.w2921 {width: 29.21%;text-align: center;}
				.w1170 {width: 11.7%;text-align: center;}
				.w2332 {width: 23.32%;text-align: center;}
			}
            .btns {width: 100%;position: absolute;bottom: 36rem;
                .btn {width: 130rem;height: 40rem;margin-left: 112rem;line-height: 40rem;text-align: center;border-radius: 3rem;font-size: 22rem;cursor: pointer;}
                .btn.sure {background: linear-gradient(0deg, #00A366 0%, #00C37A 100%);color: #FFF;}
                .btn.cancel {border: 1px solid #316EFF;background: linear-gradient(0deg, #D9DDE8 0%, #FFFFFF 100%);color: #505971;}
                .btn:first-child {margin-left: 0;}
            }
		}
	}

	/deep/ .el-radio__inner {width: 18rem;height: 18rem;}
	/deep/ .el-radio__label {font-size: 18rem;}
</style>